using System;

namespace SmartSite.Frame
{
    public struct BitsPart : IEquatable<BitsPart>
    {
        public byte Value { get; }
        public int Count { get; }

        public BitsPart(byte value, int count)
        {
            Value = value;
            Count = count;
        }

        public override int GetHashCode() => Value.GetHashCode() ^ Count.GetHashCode();
        public override bool Equals(object b) => b is BitsPart ? Equals((BitsPart)b) : false;
        public bool Equals(BitsPart b) => Value == b.Value && Count == b.Count;
        public static bool operator ==(BitsPart a, BitsPart b) => a.Equals(b);
        public static bool operator !=(BitsPart a, BitsPart b) => !a.Equals(b);
    }
}
